package dth.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;

import dth.entity.DthContact;
import dth.entity.SetupBox;

public class DthContactDAO {
	private SessionFactory sessionFactory=new AnnotationConfiguration().configure().buildSessionFactory();
	private Session session=sessionFactory.openSession();
	public List<DthContact> getDthContact(){
		session.beginTransaction();
		String queryString="select * from dth_contact";
		Query query=session.createSQLQuery(queryString).addEntity(DthContact.class);
		List<DthContact> list=query.list();
		return list;
	}
	public int edit(DthContact contact){
		Transaction tx=session.beginTransaction();
		session.update(contact);
		tx.commit();
		return 1;
		
	}
}
